<?php
class ModelFactory
{
	private static $_instance=array();
	private static $_classes=array();
	
	private static function setClasses(){
		self::$_classes=array(
			'UserModel'=>PATH_API.'/model/UserModel.php',
			'MemberModel'=>PATH_API.'/model/MemberModel.php',
		);
	}
		
	public static function get($className){
		if(!isset(self::$_instance[$className])){
			if(self::$_classes===array()) self::setClasses();
			include self::$_classes[$className];
			self::$_instance[$className]=new $className();
		}
		return self::$_instance[$className];
	}
	
	/**
	 * 销毁数组
	 */
	public static function reset(){
		self::$_instance=array();
	}
}
